import { defineStore } from 'pinia'

export const useRobotStore = defineStore('robot', {
  state: () => {
    return {
      posXArr: [],
      posYArr: [],
      posZArr: [],
      timeArr: []
    }
  },
  actions: {
    pushData (x, y, z) {
      if(this.posXArr.length >= 300) {
        this.posXArr.shift()
        this.posYArr.shift()
        this.posZArr.shift()
        this.timeArr.shift()
      }
      this.posXArr.push(x)
      this.posYArr.push(y)
      this.posZArr.push(z)
      this.timeArr.push(new Date().toLocaleTimeString())
    }
  }
})